﻿package view.sysNotice
{
    import __AS3__.vec.*;
    import com.core.*;
    import com.core.display.*;
    import com.greensock.*;
    import com.sh.game.util.*;
    import flash.display.*;
    import flash.geom.*;
    import flash.text.*;
    import flash.utils.*;

    public class GetRun extends Sprite
    {
        private var runVec:Vector.<String>;
        private var OtherVec:Vector.<String>;
        private var isShow:Boolean = false;
        private var isOtherShow:Boolean = false;
        private var _timeID:uint = 0;
        private var _timeID2:uint = 0;

        public function GetRun()
        {
            this.runVec = new Vector.<String>;
            this.OtherVec = new Vector.<String>;
            return;
        }// end function

        public function init(param1:DisplayObjectContainer, param2:int, param3:int) : void
        {
            if (!this.parent)
            {
                param1.addChild(this);
            }
            this.x = param2;
            this.y = param3;
            this.mouseEnabled = false;
            this.mouseChildren = false;
            return;
        }// end function

        public function addMessage(param1:int, param2:Array) : void
        {
            switch(param1)
            {
                case CMDGetRun.TDRUN:
                {
                    this.setTd(param2);
                    break;
                }
                case CMDGetRun.NORMALRUN:
                {
                    this.setNormal(param2);
                    break;
                }
                case CMDGetRun.INTELRUN:
                {
                    this.setIntel(param2);
                    break;
                }
                case CMDGetRun.OTHERRUN:
                {
                    this.setOther(param2);
                    break;
                }
                case CMDGetRun.MOTHEROTHERRUN:
                {
                    this.setOther(param2, true);
                    break;
                }
                case CMDGetRun.WINGANDHORSE:
                {
                    this.setWingAndHorse(param2);
                    break;
                }
                case CMDGetRun.SHENGWANG:
                {
                    this.setShengWang(param2);
                    break;
                }
                default:
                {
                    break;
                }
            }
            if (!this.isShow)
            {
                this.isShow = true;
                this.doShow();
            }
            if (!this.isOtherShow)
            {
                this.isOtherShow = true;
                this.doOtherShow();
            }
            return;
        }// end function

        private function setShengWang(param1:Array) : void
        {
            var _loc_2:String = null;
            for each (_loc_2 in param1)
            {
                
                this.OtherVec.push(MColor.getHMTL("获得声望：+" + _loc_2, 7));
            }
            return;
        }// end function

        private function setWingAndHorse(param1:Array) : void
        {
            switch(param1[1])
            {
                case 0:
                {
                    this.OtherVec.push(MColor.getHMTL("获得兽灵：+" + param1[0].replace("兽灵", ""), 7));
                    break;
                }
                case 1:
                {
                    this.OtherVec.push(MColor.getHMTL("获得羽灵：+" + param1[0].replace("羽灵", ""), 7));
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        private function setOther(param1:Array, param2:Boolean = false) : void
        {
            var _loc_3:String = null;
            for each (_loc_3 in param1)
            {
                
                if (int(_loc_3) > 200000 || param2)
                {
                    this.OtherVec.push(MColor.getHMTL("获得经验：+" + _loc_3, 7));
                }
            }
            return;
        }// end function

        private function doOtherShow() : void
        {
            if (this._timeID > 0)
            {
                clearTimeout(this._timeID);
                this._timeID = 0;
            }
            if (this.OtherVec.length <= 0)
            {
                this.isOtherShow = false;
                return;
            }
            var _loc_1:* = new TextField();
            _loc_1.defaultTextFormat = new TextFormat("宋体", 14, "0x00ff00", "blod");
            var _loc_2:* = UserData.getUserData();
            var _loc_3:* = ModelProxy.getValue("data", "stagePos");
            _loc_1.x = _loc_2.x * 48 - 24 + _loc_3.x - this.x;
            _loc_1.y = _loc_2.y * 32 - 172 + _loc_3.y - this.y;
            _loc_1.autoSize = TextFieldAutoSize.LEFT;
            var _loc_4:* = this.OtherVec.shift();
            _loc_1.htmlText = _loc_4;
            _loc_1.mouseEnabled = false;
            this.addChild(_loc_1);
            TweenLite.to(_loc_1, 5, {y:_loc_1.y - 66, onComplete:this.doRemove, onCompleteParams:[_loc_1]});
            if (this._timeID > 0)
            {
                clearTimeout(this._timeID);
                this._timeID = 0;
            }
            this._timeID = setTimeout(this.doOtherShow, 500);
            return;
        }// end function

        public function setIntel(param1:Array) : void
        {
            var _loc_2:String = null;
            for each (_loc_2 in param1)
            {
                
                this.OtherVec.push(MColor.getHMTL("获得内力：+" + _loc_2, 7));
            }
            return;
        }// end function

        public function setTd(param1:Array) : void
        {
            var _loc_2:String = null;
            for each (_loc_2 in param1)
            {
                
                this.runVec.push(MColor.getHMTL("累计获得经验：" + _loc_2, 6));
            }
            return;
        }// end function

        public function setNormal(param1:Array) : void
        {
            var _loc_2:String = null;
            for each (_loc_2 in param1)
            {
                
                this.runVec.push(MColor.getHMTL("获得经验：+" + _loc_2, 64));
            }
            return;
        }// end function

        private function doShow() : void
        {
            if (this._timeID2 > 0)
            {
                clearTimeout(this._timeID2);
                this._timeID2 = 0;
            }
            if (this.runVec.length <= 0)
            {
                this.isShow = false;
                return;
            }
            var _loc_1:* = new TextField();
            _loc_1.autoSize = TextFieldAutoSize.LEFT;
            var _loc_2:* = this.runVec.shift();
            _loc_1.htmlText = _loc_2;
            _loc_1.mouseEnabled = false;
            this.addChild(_loc_1);
            TweenLite.to(_loc_1, 2, {y:_loc_1.y - 66, onComplete:this.doRemove, onCompleteParams:[_loc_1]});
            this._timeID2 = setTimeout(this.doShow, 250);
            return;
        }// end function

        public function doRemove(param1:TextField) : void
        {
            this.removeChild(param1);
            param1 = null;
            return;
        }// end function

    }
}
